<?php
namespace app\common\model;
use think\Model;

class StaffProfileModel extends Model{
    protected  $name = 'staff_profile';
    protected  $pk   = 'staff_id';

    // 设置json类型字段
    protected $json = ['profile_custom'];
    // 设置JSON数据返回数组
    protected $jsonAssoc = true;

    public static function onBeforeInsert($model)
    {
        $model->set("create_ip", request()->ip());
    }
    public function staff(){
        return $this->hasOne(StaffModel::class,'staff_id','staff_id')->bind(['name']);
    }
}
